/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mapping;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "empleado")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Empleado.findAll", query = "SELECT e FROM Empleado e"),
    @NamedQuery(name = "Empleado.findByIdEmpleado", query = "SELECT e FROM Empleado e WHERE e.idEmpleado = :idEmpleado"),
    @NamedQuery(name = "Empleado.findByNombre", query = "SELECT e FROM Empleado e WHERE e.nombre = :nombre"),
    @NamedQuery(name = "Empleado.findByPuesto", query = "SELECT e FROM Empleado e WHERE e.puesto = :puesto")})
public class Empleado implements Serializable {
    @OneToMany(mappedBy = "empResolvio")
    private Collection<Solucion> solucionCollection;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idEmpleado")
    private String idEmpleado;
    @Column(name = "nombre")
    private String nombre;
    @Column(name = "puesto")
    private String puesto;
    @JoinTable(name = "disp_empleado", joinColumns = {
        @JoinColumn(name = "idEmpleado", referencedColumnName = "idEmpleado")}, inverseJoinColumns = {
        @JoinColumn(name = "idDisp", referencedColumnName = "idDisp")})
    @ManyToMany
    private Collection<Dispositivo> dispositivoCollection;
    @JoinColumn(name = "departamento", referencedColumnName = "idDepartamento")
    @ManyToOne
    private Departamento departamento;
    @OneToMany(mappedBy = "empResolvio")
    private Collection<Ticket> ticketCollection;
    @OneToMany(mappedBy = "empSolicito")
    private Collection<Ticket> ticketCollection1;
    @OneToMany(mappedBy = "empAtendio")
    private Collection<Ticket> ticketCollection2;
    @OneToMany(mappedBy = "idempleado")
    private Collection<Login> loginCollection;

    public Empleado() {
    }

    public Empleado(String idEmpleado) {
        this.idEmpleado = idEmpleado;
    }

    public String getIdEmpleado() {
        return idEmpleado;
    }

    public void setIdEmpleado(String idEmpleado) {
        this.idEmpleado = idEmpleado;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getPuesto() {
        return puesto;
    }

    public void setPuesto(String puesto) {
        this.puesto = puesto;
    }

    @XmlTransient
    public Collection<Dispositivo> getDispositivoCollection() {
        return dispositivoCollection;
    }

    public void setDispositivoCollection(Collection<Dispositivo> dispositivoCollection) {
        this.dispositivoCollection = dispositivoCollection;
    }

    public Departamento getDepartamento() {
        return departamento;
    }

    public void setDepartamento(Departamento departamento) {
        this.departamento = departamento;
    }

    @XmlTransient
    public Collection<Ticket> getTicketCollection() {
        return ticketCollection;
    }

    public void setTicketCollection(Collection<Ticket> ticketCollection) {
        this.ticketCollection = ticketCollection;
    }

    @XmlTransient
    public Collection<Ticket> getTicketCollection1() {
        return ticketCollection1;
    }

    public void setTicketCollection1(Collection<Ticket> ticketCollection1) {
        this.ticketCollection1 = ticketCollection1;
    }

    @XmlTransient
    public Collection<Ticket> getTicketCollection2() {
        return ticketCollection2;
    }

    public void setTicketCollection2(Collection<Ticket> ticketCollection2) {
        this.ticketCollection2 = ticketCollection2;
    }

    @XmlTransient
    public Collection<Login> getLoginCollection() {
        return loginCollection;
    }

    public void setLoginCollection(Collection<Login> loginCollection) {
        this.loginCollection = loginCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEmpleado != null ? idEmpleado.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Empleado)) {
            return false;
        }
        Empleado other = (Empleado) object;
        if ((this.idEmpleado == null && other.idEmpleado != null) || (this.idEmpleado != null && !this.idEmpleado.equals(other.idEmpleado))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mapping.Empleado[ idEmpleado=" + idEmpleado + " ]";
    }

    @XmlTransient
    public Collection<Solucion> getSolucionCollection() {
        return solucionCollection;
    }

    public void setSolucionCollection(Collection<Solucion> solucionCollection) {
        this.solucionCollection = solucionCollection;
    }
    
}
